package android.slc.box.core.launcher;

import android.slc.box.core.compat.WindowLauncherBuilder;
import de.saxsys.mvvmfx.Scope;
import javafx.stage.Window;

/**
 * @author slc
 * @date 2022/09/27 上午 9:50
 */
public class EmbeddedWindowBuilder extends WindowLauncherBuilder<Window, EmbeddedWindowLauncher, EmbeddedWindowBuilder> {
    private Scope windowScope;

    public static EmbeddedWindowBuilder newBuilder() {
        return new EmbeddedWindowBuilder();
    }

    public EmbeddedWindowBuilder setWindowScope(Scope windowScope) {
        this.windowScope = windowScope;
        return this;
    }

    @Override
    public EmbeddedWindowLauncher build() {
        if (this.windowScope != null) {
            EmbeddedWindowLauncherImpl stageLauncher = new EmbeddedWindowLauncherImpl(windowScope, stylesheets, bundle);
            return stageLauncher;
        } else {
            EmbeddedWindowLauncherImpl stageLauncher = new EmbeddedWindowLauncherImpl(currentWindow, stylesheets, bundle);
            return stageLauncher;
        }
    }
}
